{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "397a6f86",
   "metadata": {},
   "source": [
    ".gitignore 文件用于指定哪些文件或目录不应该被 Git 版本控制。\n",
    "\n",
    "一定要将虚拟环境添加到 .gitignore 文件中，否则会导致虚拟环境中的所有文件都被 Git 版本控制。\n",
    "\n",
    "例如：\n",
    "\n",
    "```\n",
    ".venv\n",
    "```\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2f2620e4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "fa0790d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>day</th>\n",
       "      <th>STOCK_CODE</th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "      <th>maximum</th>\n",
       "      <th>minimum</th>\n",
       "      <th>volume</th>\n",
       "      <th>TURNOVER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2001/8/27</td>\n",
       "      <td>6005191</td>\n",
       "      <td>34.51</td>\n",
       "      <td>35.55</td>\n",
       "      <td>37.78</td>\n",
       "      <td>32.85</td>\n",
       "      <td>406318</td>\n",
       "      <td>1410347008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2001/8/28</td>\n",
       "      <td>6005191</td>\n",
       "      <td>34.99</td>\n",
       "      <td>36.86</td>\n",
       "      <td>37.00</td>\n",
       "      <td>34.61</td>\n",
       "      <td>129647</td>\n",
       "      <td>463463008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2001/8/28</td>\n",
       "      <td>6005191</td>\n",
       "      <td>34.99</td>\n",
       "      <td>36.86</td>\n",
       "      <td>37.00</td>\n",
       "      <td>34.61</td>\n",
       "      <td>129647</td>\n",
       "      <td>463463008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2001/8/29</td>\n",
       "      <td>6005191</td>\n",
       "      <td>36.98</td>\n",
       "      <td>36.38</td>\n",
       "      <td>37.00</td>\n",
       "      <td>36.10</td>\n",
       "      <td>53252</td>\n",
       "      <td>194689000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2001/8/30</td>\n",
       "      <td>6005191</td>\n",
       "      <td>36.28</td>\n",
       "      <td>37.10</td>\n",
       "      <td>37.51</td>\n",
       "      <td>36.00</td>\n",
       "      <td>48013</td>\n",
       "      <td>177558000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         day  STOCK_CODE   open  close  maximum  minimum  volume    TURNOVER\n",
       "0  2001/8/27     6005191  34.51  35.55    37.78    32.85  406318  1410347008\n",
       "1  2001/8/28     6005191  34.99  36.86    37.00    34.61  129647   463463008\n",
       "2  2001/8/28     6005191  34.99  36.86    37.00    34.61  129647   463463008\n",
       "3  2001/8/29     6005191  36.98  36.38    37.00    36.10   53252   194689000\n",
       "4  2001/8/30     6005191  36.28  37.10    37.51    36.00   48013   177558000"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1 = pd.read_csv(R'data\\csv\\600519.csv')\n",
    "df1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "2a0b4017",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>招聘单位</th>\n",
       "      <th>薪资区间</th>\n",
       "      <th>招聘岗位</th>\n",
       "      <th>工作地点</th>\n",
       "      <th>工作经验</th>\n",
       "      <th>学历要求</th>\n",
       "      <th>岗位属性</th>\n",
       "      <th>类别</th>\n",
       "      <th>发布时间</th>\n",
       "      <th>职位诱惑</th>\n",
       "      <th>职位描述</th>\n",
       "      <th>工作地址</th>\n",
       "      <th>爬取时间</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>彬煌投资贸易</td>\n",
       "      <td>5k-8k·13薪</td>\n",
       "      <td>大数据分析助理</td>\n",
       "      <td>深圳</td>\n",
       "      <td>经验不限</td>\n",
       "      <td>大专及以上</td>\n",
       "      <td>全职</td>\n",
       "      <td>| 电商 | 分类信息 |</td>\n",
       "      <td>16:12</td>\n",
       "      <td>五险一金 年底双薪 包住 全勤奖 带薪年假</td>\n",
       "      <td>NaN</td>\n",
       "      <td>深圳-罗湖区-笋岗</td>\n",
       "      <td>2020-09-07 21:11:55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>快手</td>\n",
       "      <td>20k-40k</td>\n",
       "      <td>（大数据专场）Java后端研发...</td>\n",
       "      <td>北京</td>\n",
       "      <td>经验3-5年</td>\n",
       "      <td>本科及以上</td>\n",
       "      <td>全职</td>\n",
       "      <td>|</td>\n",
       "      <td>17:53</td>\n",
       "      <td>大牛多</td>\n",
       "      <td>NaN</td>\n",
       "      <td>北京-海淀区-西二旗-上地西路6号快手总部</td>\n",
       "      <td>2020-09-07 21:12:01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>快手</td>\n",
       "      <td>35k-65k</td>\n",
       "      <td>广告数据开发专家-【商业化...</td>\n",
       "      <td>北京</td>\n",
       "      <td>经验3-5年</td>\n",
       "      <td>本科及以上</td>\n",
       "      <td>全职</td>\n",
       "      <td>|</td>\n",
       "      <td>10:42</td>\n",
       "      <td>期权激励,核心业务</td>\n",
       "      <td>NaN</td>\n",
       "      <td>北京-海淀区-西二旗-海淀东升科技园北领地B-2</td>\n",
       "      <td>2020-09-07 21:12:07</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     招聘单位       薪资区间                招聘岗位 工作地点    工作经验   学历要求 岗位属性  \\\n",
       "0  彬煌投资贸易  5k-8k·13薪             大数据分析助理   深圳    经验不限  大专及以上   全职   \n",
       "1      快手    20k-40k  （大数据专场）Java后端研发...   北京  经验3-5年  本科及以上   全职   \n",
       "2      快手    35k-65k    广告数据开发专家-【商业化...   北京  经验3-5年  本科及以上   全职   \n",
       "\n",
       "              类别   发布时间                   职位诱惑 职位描述                      工作地址  \\\n",
       "0  | 电商 | 分类信息 |  16:12  五险一金 年底双薪 包住 全勤奖 带薪年假  NaN                 深圳-罗湖区-笋岗   \n",
       "1              |  17:53                    大牛多  NaN     北京-海淀区-西二旗-上地西路6号快手总部   \n",
       "2              |  10:42              期权激励,核心业务  NaN  北京-海淀区-西二旗-海淀东升科技园北领地B-2   \n",
       "\n",
       "                  爬取时间  \n",
       "0  2020-09-07 21:11:55  \n",
       "1  2020-09-07 21:12:01  \n",
       "2  2020-09-07 21:12:07  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2 = pd.read_excel(R\"data\\xls\\招聘信息v2.xlsx\")\n",
    "df2.head(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "e2fee030",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>编号</th>\n",
       "      <th>开始答题时间</th>\n",
       "      <th>结束答题时间</th>\n",
       "      <th>答题时长</th>\n",
       "      <th>Q1_填空1</th>\n",
       "      <th>Q3</th>\n",
       "      <th>Q4</th>\n",
       "      <th>Q5</th>\n",
       "      <th>Q6</th>\n",
       "      <th>Q7</th>\n",
       "      <th>Q8</th>\n",
       "      <th>Q9</th>\n",
       "      <th>Q10</th>\n",
       "      <th>Q11</th>\n",
       "      <th>Q12</th>\n",
       "      <th>总得分</th>\n",
       "      <th>最后一个基本个案</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>155.0</td>\n",
       "      <td>20-Jun-2023 15:02:13</td>\n",
       "      <td>20-Jun-2023 15:03:01</td>\n",
       "      <td>48.0</td>\n",
       "      <td>P201212152</td>\n",
       "      <td>30px</td>\n",
       "      <td>transform: scale(0.5);</td>\n",
       "      <td>ul li:last-child</td>\n",
       "      <td>红色</td>\n",
       "      <td>/* comment */</td>\n",
       "      <td>缺少content属性</td>\n",
       "      <td>text-opacity</td>\n",
       "      <td>ul li:nth-child(3)</td>\n",
       "      <td>以上都对</td>\n",
       "      <td>B</td>\n",
       "      <td>100</td>\n",
       "      <td>主个案</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>194.0</td>\n",
       "      <td>20-Jun-2023 15:15:15</td>\n",
       "      <td>20-Jun-2023 15:16:23</td>\n",
       "      <td>68.0</td>\n",
       "      <td>P201212142</td>\n",
       "      <td>30px</td>\n",
       "      <td>transform: scale(0.5);</td>\n",
       "      <td>ul li:last-child</td>\n",
       "      <td>红色</td>\n",
       "      <td>/* comment */</td>\n",
       "      <td>缺少content属性</td>\n",
       "      <td>text-opacity</td>\n",
       "      <td>ul li:nth-child(3)</td>\n",
       "      <td>以上都对</td>\n",
       "      <td>B</td>\n",
       "      <td>100</td>\n",
       "      <td>主个案</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>195.0</td>\n",
       "      <td>20-Jun-2023 15:17:09</td>\n",
       "      <td>20-Jun-2023 15:17:42</td>\n",
       "      <td>33.0</td>\n",
       "      <td>P201212158</td>\n",
       "      <td>30px</td>\n",
       "      <td>transform: scale(0.5);</td>\n",
       "      <td>ul li:last-child</td>\n",
       "      <td>红色</td>\n",
       "      <td>/* comment */</td>\n",
       "      <td>缺少content属性</td>\n",
       "      <td>text-opacity</td>\n",
       "      <td>ul li:nth-child(3)</td>\n",
       "      <td>以上都对</td>\n",
       "      <td>B</td>\n",
       "      <td>100</td>\n",
       "      <td>主个案</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>166.0</td>\n",
       "      <td>20-Jun-2023 15:05:34</td>\n",
       "      <td>20-Jun-2023 15:06:20</td>\n",
       "      <td>46.0</td>\n",
       "      <td>p201212356</td>\n",
       "      <td>30px</td>\n",
       "      <td>transform: scale(0.5);</td>\n",
       "      <td>ul li:last-child</td>\n",
       "      <td>红色</td>\n",
       "      <td>/* comment */</td>\n",
       "      <td>缺少content属性</td>\n",
       "      <td>text-opacity</td>\n",
       "      <td>ul li:nth-child(3)</td>\n",
       "      <td>以上都对</td>\n",
       "      <td>B</td>\n",
       "      <td>100</td>\n",
       "      <td>主个案</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>186.0</td>\n",
       "      <td>20-Jun-2023 15:11:39</td>\n",
       "      <td>20-Jun-2023 15:12:42</td>\n",
       "      <td>63.0</td>\n",
       "      <td>p201212080</td>\n",
       "      <td>30px</td>\n",
       "      <td>transform: scale(0.5);</td>\n",
       "      <td>ul li:last-child</td>\n",
       "      <td>红色</td>\n",
       "      <td>/* comment */</td>\n",
       "      <td>缺少content属性</td>\n",
       "      <td>text-opacity</td>\n",
       "      <td>ul li:nth-child(3)</td>\n",
       "      <td>以上都对</td>\n",
       "      <td>B</td>\n",
       "      <td>100</td>\n",
       "      <td>主个案</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      编号                开始答题时间                结束答题时间  答题时长      Q1_填空1    Q3  \\\n",
       "0  155.0  20-Jun-2023 15:02:13  20-Jun-2023 15:03:01  48.0  P201212152  30px   \n",
       "1  194.0  20-Jun-2023 15:15:15  20-Jun-2023 15:16:23  68.0  P201212142  30px   \n",
       "2  195.0  20-Jun-2023 15:17:09  20-Jun-2023 15:17:42  33.0  P201212158  30px   \n",
       "3  166.0  20-Jun-2023 15:05:34  20-Jun-2023 15:06:20  46.0  p201212356  30px   \n",
       "4  186.0  20-Jun-2023 15:11:39  20-Jun-2023 15:12:42  63.0  p201212080  30px   \n",
       "\n",
       "                       Q4                Q5  Q6             Q7           Q8  \\\n",
       "0  transform: scale(0.5);  ul li:last-child  红色  /* comment */  缺少content属性   \n",
       "1  transform: scale(0.5);  ul li:last-child  红色  /* comment */  缺少content属性   \n",
       "2  transform: scale(0.5);  ul li:last-child  红色  /* comment */  缺少content属性   \n",
       "3  transform: scale(0.5);  ul li:last-child  红色  /* comment */  缺少content属性   \n",
       "4  transform: scale(0.5);  ul li:last-child  红色  /* comment */  缺少content属性   \n",
       "\n",
       "             Q9                 Q10   Q11 Q12  总得分 最后一个基本个案  \n",
       "0  text-opacity  ul li:nth-child(3)  以上都对   B  100      主个案  \n",
       "1  text-opacity  ul li:nth-child(3)  以上都对   B  100      主个案  \n",
       "2  text-opacity  ul li:nth-child(3)  以上都对   B  100      主个案  \n",
       "3  text-opacity  ul li:nth-child(3)  以上都对   B  100      主个案  \n",
       "4  text-opacity  ul li:nth-child(3)  以上都对   B  100      主个案  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3 = pd.read_spss(R\"data\\sav\\测试成绩.sav\")\n",
    "df3.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "9bc3dbdb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>None</td>\n",
       "      <td>a(an)</td>\n",
       "      <td>[ə] 、 [ən]</td>\n",
       "      <td>art. 一（个，件）</td>\n",
       "      <td>An hour ago, a European bought an\\nMP3.</td>\n",
       "      <td>1 小时前，一位欧洲人买了一个 MP3。</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>None</td>\n",
       "      <td>abandon</td>\n",
       "      <td>[əˈbændən]</td>\n",
       "      <td>vt.放弃，抛弃;</td>\n",
       "      <td>He abandoned his wife and children\\nand went a...</td>\n",
       "      <td>他抛妻弃子，并带走了所有的钱。</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   0     1        2           3            4  \\\n",
       "0  1  None    a(an)  [ə] 、 [ən]  art. 一（个，件）   \n",
       "1  2  None  abandon  [əˈbændən]    vt.放弃，抛弃;   \n",
       "\n",
       "                                                   5                     6  \\\n",
       "0            An hour ago, a European bought an\\nMP3.  1 小时前，一位欧洲人买了一个 MP3。   \n",
       "1  He abandoned his wife and children\\nand went a...       他抛妻弃子，并带走了所有的钱。   \n",
       "\n",
       "      7  \n",
       "0  None  \n",
       "1  None  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pdfplumber\n",
    "import pandas as pd\n",
    "pdf = pdfplumber.open(R'data\\pdf\\高考核心词汇1278.pdf')\n",
    "\n",
    "table = []\n",
    "# len(pdf.pages)获取全部pdf页数；\n",
    "for i in range(len(pdf.pages) - 1):\n",
    "    # 通过循环逐页读取当前页面中的表格；\n",
    "    page = pdf.pages[i + 1]\n",
    "    table.extend(page.extract_table())\n",
    "# 将表格转化为Pandas中的`DataFrame`。\n",
    "table1_df = pd.DataFrame(table[2:])\n",
    "table1_df.head(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "f36f7b26",
   "metadata": {},
   "outputs": [],
   "source": [
    "table1_df.to_csv(R'output\\高考核心词汇1278.csv', index=False, encoding='utf-8')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
